package com.levi.springextension;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;

/** 3
 * @author shentong
 * @since 2023/1/12 12:43
 * 在spring读取bean定义之后，实例化bean之前执行
 * 可以修改已经注册的bean定义的元信息
 */
public class MyBeanFactoryPostProcessor implements BeanFactoryPostProcessor {
    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
        BeanDefinition beanDefinition = beanFactory.getBeanDefinition("testRegistryPostProcessor");
        //对该beandefinetion做一些其他操作
    }
}
